﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using OSGeo.MapGuide;

namespace IGIS.Core
{
    public static class HtzSdfHelper
    {
        // Methods
        public static MgDataPropertyDefinition CreateDateTimeProperty(string propertyName)
        {
            return new MgDataPropertyDefinition(propertyName) { DataType = 3, Nullable = true, ReadOnly = false };
        }

        public static MgDataPropertyDefinition CreateDoubleProperty(string propertyName)
        {
            return new MgDataPropertyDefinition(propertyName) { DataType = 5, Nullable = true, ReadOnly = false };
        }

        public static MgGeometricPropertyDefinition CreateGeometricProperty(string contextName)
        {
            return new MgGeometricPropertyDefinition("Geometry") { GeometryTypes = 7, HasElevation = false, HasMeasure = false, ReadOnly = false, SpatialContextAssociation = contextName };
        }

        public static MgPropertyDefinition CreateIdProperty()
        {
            return CreateIdProperty("FeatId");
        }

        public static MgPropertyDefinition CreateIdProperty(string name)
    {
        MgDataPropertyDefinition id = new MgDataPropertyDefinition(name) {
            DataType = 7,
            ReadOnly = true,
            Nullable = false
        };
     
        id.SetAutoGeneration(true);
        return id;
    }

        public static MgDataPropertyDefinition CreateIntProperty(string propertyName)
        {
            return new MgDataPropertyDefinition(propertyName) { DataType = 7, Nullable = true, ReadOnly = false };
        }

        public static MgDataPropertyDefinition CreateTextProperty(string propertyName, int length)
        {
            return new MgDataPropertyDefinition(propertyName) { DataType = 9, Length = length, Nullable = true, ReadOnly = false };
        }
    }


}